﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core;
using COFE.Core.Lister;
using COFE.Core.Utils;

namespace COFE.Core.Profile
{
    //public class VolumeInfo
    //{
    //    public IFactory<IDirectoryLister> Factory { get; set; }
    //    public string ListerKey { get; set; }
    //    public string[] Parameters { get; set; }
    //}

    public interface IVolumeRegistrar
    {
        #region Properties

        /// <summary>
        /// Return a list of volumes construction informations (directorylisters), which defines the file system.
        /// </summary>
        Dictionary<string, IVolume> Volumes { get; }

        /// <summary>
        /// Returned a list of volume factories, which construct volumes (directorylisters).
        /// </summary>
        Dictionary<string, IFactory<IDirectoryLister>> Factories { get; } 

        #endregion

        #region Methods

        /// <summary>
        /// Register a directory volume factory, registered factories are shared between all instances.
        /// </summary>
        /// <param name="factoryKey"></param>
        /// <param name="listerKey"></param>
        /// <param name="volume"></param>
        void RegisterFactory(IFactory<IDirectoryLister> listerFactory);

        /// <summary>
        /// Register a volume that contins a PrimaryDirectoryLister or SecondaryDirectoryLister.
        /// Replace if already exists.
        /// </summary>
        /// <param name="volume"></param>
        /// <param name="autoRegister">Whether userprofile register the volume automatically.</param>
        void RegisterVolume(IVolume volume);

        /// <summary>
        /// Construct a volume from directory lister.
        /// </summary>
        /// <param name="factoryKey"></param>
        /// <param name="lister"></param>
        /// <returns></returns>
        IVolume ConstructVolume(string factoryId, IDirectoryLister lister, VolumeAccessMode defAccessMode);

        /// <summary>
        /// Construct a volume from a factory.     
        /// </summary>
        /// <param name="volume"></param>
        IVolume ConstructVolume(string factoryId, string volumeId, string paramString, VolumeAccessMode defAccessMode);

        /// <summary>
        /// Remove all registered volumes.
        /// </summary>
        void RemoveVolume(string volumeId);

        /// <summary>
        /// Lookup a registered volume, using its key.
        /// </summary>
        /// <param name="listerKey"></param>
        /// <returns></returns>
        IVolume LookupRegisterVolume(string volumeId);

        #endregion
    }
}
